package com.jushu.storbox.view.dialog;

import android.app.Activity;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;

import com.jushu.storbox.R;

public class MoreFragmentWindow extends PopupWindow{
	
	    public MoreFragmentWindow(Activity context) {  
	        super(context);  
	        LayoutInflater inflater = (LayoutInflater) context  
	                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);  
	        final View mMenuView = inflater.inflate(R.layout.more_popupmenu, null);  
	        RelativeLayout layout_photo_bakup = (RelativeLayout) mMenuView.findViewById(R.id.layout_photo_bakup);
	        layout_photo_bakup.setOnClickListener(new View.OnClickListener()
	        {
	            @Override
	            public void onClick(View v)
	            {
	            }
	        });
	        
	        RelativeLayout layout_trans = (RelativeLayout) mMenuView.findViewById(R.id.layout_translate);
	        layout_trans.setOnClickListener(new View.OnClickListener()
	        {
	            @Override
	            public void onClick(View v)
	            {
	            }
	        });
	        
	        RelativeLayout layout_setting = (RelativeLayout) mMenuView.findViewById(R.id.layout_setting);
	        layout_setting.setOnClickListener(new View.OnClickListener()
	        {
	            @Override
	            public void onClick(View v)
	            {
	            }
	        });
	        
//	        LinearLayout layout_frame = (LinearLayout) mMenuView.findViewById(R.id.layout_frame);
////	        layout_frame.setOnClickListener(new View.OnClickListener()
//	        {
//	            @Override
//	            public void onClick(View v)
//	            {
//	            	MoreFragmentWindow.this.dismiss();
//	            }
//	        });
	        //取消按钮  
//	        btn_cancel.setOnClickListener(new OnClickListener() {  
//	  
//	            public void onClick(View v) {  
//	                //销毁弹出框  
//	                dismiss();  
//	            }  
//	        });  
	        //设置按钮监听  
	        //设置SelectPicPopupWindow的View  
	        this.setContentView(mMenuView);  
	        //设置SelectPicPopupWindow弹出窗体的宽  
	        this.setWidth(LayoutParams.WRAP_CONTENT);  
	        //设置SelectPicPopupWindow弹出窗体的高  
	        this.setHeight(LayoutParams.WRAP_CONTENT);  
	        //设置SelectPicPopupWindow弹出窗体可点击  
	        this.setFocusable(true);  
	        //设置SelectPicPopupWindow弹出窗体动画效果  
//	        this.setAnimationStyle(R.style.AnimBottom);  
	        //实例化一个ColorDrawable颜色为半透明  
	        ColorDrawable dw = new ColorDrawable(0xb0000000);  
	        //设置SelectPicPopupWindow弹出窗体的背景  
	        this.setBackgroundDrawable(dw);  
	        //mMenuView添加OnTouchListener监听判断获取触屏位置如果在选择框外面则销毁弹出框  
//	        mMenuView.setOnTouchListener(new OnTouchListener() {  
//	              
//	            public boolean onTouch(View v, MotionEvent event) {  
//	                  
//	                int height = mMenuView.findViewById(R.id.pop_layout).getTop();  
//	                int y=(int) event.getY();  
//	                if(event.getAction()==MotionEvent.ACTION_UP){  
//	                    if(y<height){  
//	                        dismiss();  
//	                    }  
//	                }                 
//	                return true;  
//	            }  
//	        });  
	  
	    }  
}
